package com.cjm.one.model.coupon.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;

import java.time.LocalDateTime;
import java.util.Date;

import com.cjm.one.model.base.BaseEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 乘客优惠券关联表
 * @TableName customer_coupon
 */
@TableName(value ="customer_coupon")
@Data
@AllArgsConstructor
@Builder
@NoArgsConstructor
public class CustomerCoupon extends BaseEntity {
    /**
     * 编号
     */
//    @TableId(type = IdType.AUTO)
//    private Long id;

    /**
     * 优惠券ID
     */
    @TableField("coupon_id")
    @Schema(description = "优惠券ID")
    private Long couponId;

    /**
     * 乘客ID
     */
    @Schema(description = "乘客ID")
    @TableField("customer_id")
    private Long customerId;

    /**
     * 优化券状态（1：未使用 2：已使用）
     */
    @Schema(description = "优化券状态（1：未使用 2：已使用）")
    @TableField("status")
    private Integer status;

    /**
     * 领取时间
     */
    @Schema(description = "领取时间")
    @TableField("receive_time")
    private LocalDateTime receiveTime;

    /**
     * 使用时间
     */
    @Schema(description = "使用时间")
    @TableField("used_time")
    private LocalDateTime usedTime;

    /**
     * 订单id
     */
    @Schema(description = "订单id")
    @TableField("order_id")
    private Long orderId;

    /**
     * 过期时间
     */
    @Schema(description = "过期时间")
    @TableField("expire_time")
    private LocalDateTime expireTime;

    /**
     * 创建时间
     */
//    private Date createTime;
//
//    /**
//     * 更新时间
//     */
//    private Date updateTime;
//
//    /**
//     * 删除标记（0:不可用 1:可用）
//     */
//    private Integer isDeleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CustomerCoupon other = (CustomerCoupon) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCouponId() == null ? other.getCouponId() == null : this.getCouponId().equals(other.getCouponId()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
            && (this.getReceiveTime() == null ? other.getReceiveTime() == null : this.getReceiveTime().equals(other.getReceiveTime()))
            && (this.getUsedTime() == null ? other.getUsedTime() == null : this.getUsedTime().equals(other.getUsedTime()))
            && (this.getOrderId() == null ? other.getOrderId() == null : this.getOrderId().equals(other.getOrderId()))
            && (this.getExpireTime() == null ? other.getExpireTime() == null : this.getExpireTime().equals(other.getExpireTime()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getIsDeleted() == null ? other.getIsDeleted() == null : this.getIsDeleted().equals(other.getIsDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCouponId() == null) ? 0 : getCouponId().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getReceiveTime() == null) ? 0 : getReceiveTime().hashCode());
        result = prime * result + ((getUsedTime() == null) ? 0 : getUsedTime().hashCode());
        result = prime * result + ((getOrderId() == null) ? 0 : getOrderId().hashCode());
        result = prime * result + ((getExpireTime() == null) ? 0 : getExpireTime().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getIsDeleted() == null) ? 0 : getIsDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(this.getId());
        sb.append(", couponId=").append(couponId);
        sb.append(", customerId=").append(customerId);
        sb.append(", status=").append(status);
        sb.append(", receiveTime=").append(receiveTime);
        sb.append(", usedTime=").append(usedTime);
        sb.append(", orderId=").append(orderId);
        sb.append(", expireTime=").append(expireTime);
        sb.append(", createTime=").append(this.getCreateTime());
        sb.append(", updateTime=").append(this.getUpdateTime());
        sb.append(", isDeleted=").append(this.getIsDeleted());
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}